package com.linchuan.concurrency;

public class Main {
  public static void main(String[] args) {
    PrimeGenerator generator = new PrimeGenerator();
    new Thread(generator).start();
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    } finally {
      generator.cancel();
    }
    var r = generator.get();
    System.out.println(r.size() + ": " + r.get(r.size() - 1));
  }
}
